Skip to content

[tests-only][full-ci] test: set custom auth level names #12548

Open
PrajwolAmatya wants to merge 1 commit into
owncloud:masterfrom
PrajwolAmatya:test/acr-value
Open

[tests-only][full-ci] test: set custom auth level names #12548
PrajwolAmatya wants to merge 1 commit into
owncloud:masterfrom
PrajwolAmatya:test/acr-value

Conversation

@PrajwolAmatya

@PrajwolAmatya PrajwolAmatya commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Added test to set the custom auth level names and check if that works correctly.

Related Issue

OCISDEV-1014

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@kw-security

kw-security commented Jul 10, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@PrajwolAmatya PrajwolAmatya force-pushed the test/acr-value branch 5 times, most recently from efe96d7 to 389e8b6 Compare July 14, 2026 06:22
@PrajwolAmatya PrajwolAmatya changed the title [tests-only][full-ci] test: check acr vaule in jwt token [tests-only][full-ci] test: set custom auth level names Jul 14, 2026
Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
@PrajwolAmatya PrajwolAmatya self-assigned this Jul 14, 2026
@PrajwolAmatya PrajwolAmatya marked this pull request as ready for review July 14, 2026 06:36
@PrajwolAmatya PrajwolAmatya requested a review from a team as a code owner July 14, 2026 06:36
Comment on lines +369 to +381
if ($response->getStatusCode() === 200) {
return;
}
if (KeycloakHelper::isTestingWithKeycloak()) {
$this->waitForOcisProxyReady();
return;
}
Assert::assertEquals(
200,
$response->getStatusCode(),
"Failed to rollback ocis server. Check if oCIS is started with ociswrapper. Response: $resBody",
$errorMessage . " Response: " . $response->getBody()->getContents(),
);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($response->getStatusCode() === 200) {
return;
}
if (KeycloakHelper::isTestingWithKeycloak()) {
$this->waitForOcisProxyReady();
return;
}
Assert::assertEquals(
200,
$response->getStatusCode(),
"Failed to rollback ocis server. Check if oCIS is started with ociswrapper. Response: $resBody",
$errorMessage . " Response: " . $response->getBody()->getContents(),
);
}
$statusCode = $response->getStatusCode();
if ($statusCode=== 200) {
return;
}
if (KeycloakHelper::isTestingWithKeycloak()) {
$this->waitForOcisProxyReady();
return;
}
Assert::assertEquals(
200,
$statusCode,
$errorMessage . " Response: " . $response->getBody()->getContents(),
);
}

return;
}
} catch (\Exception $e) {
echo "oCIS not ready yet. Retrying in 1s...";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "oCIS not ready yet. Retrying in 1s...";
echo "oCIS not ready yet. Retrying in 1s...\n";

Comment on lines +396 to +399
$response = HttpRequestHelper::get($readyzUrl);
if ($response->getStatusCode() === 200) {
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the response has useful information, we can check it too. Otherwise, the existing status code check is enough.

return;
}
} catch (\Exception $e) {
echo "oCIS not ready yet. Retrying in 1s...";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to include the exception message in the output.

* @return void
* @throws Exception
*/
public function userShouldHaveAcrVaule(string $user, string $acr): void {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function userShouldHaveAcrVaule(string $user, string $acr): void {
public function userShouldHaveAcrValue(string $user, string $acr): void {

Assert::assertEquals(
$acr,
$actualAcr,
"Exected acr value to be $acr but got $actualAcr",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Exected acr value to be $acr but got $actualAcr",
"Expected acr value to be $acr but got $actualAcr",

* @throws Exception
*/
public function userShouldHaveAcrVaule(string $user, string $acr): void {
$access_token = $this->featureContext->getOcisUserToken($user)['token']['accessToken'];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$access_token = $this->featureContext->getOcisUserToken($user)['token']['accessToken'];
$accessToken = $this->featureContext->getOcisUserToken($user)['token']['accessToken'];

[
'Authorization' => 'Bearer ' . self::getAdminAccessToken(),
],
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be good to check the response status code here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants